/*******************************************OVERVIEW****************************************************************
 
"Reassessing the Link between Revolutionary Threats and Democratization" 
 
Replication File
 
Figure D1
 
  
********************************************************************************************************************/

clear
set more off
#delimit ;


/*Set Directory -- You will need to adjust this line of code accordingly */; 

cd "/Users/YourFiles/Replication/";

/*Create Log File*/;

log using "Figure D1", replace text;


/*Load Data File  - You will need to download AF's replicaton files*/;

/* https://www.econometricsociety.org/publications/econometrica/browse/2015/03/01/democratization-under-threat-revolution-evidence-great-reform */;

/*Please use the data file data_seat.dta*/;


use  "/Users/YourFiles/11484_Data_and_Programs/data/data_seat.dta";

global base_nu "county narrow rottenindex";
global reform "share1826 share1826_2 reform_1830";
global demographic "h_index1831 primary secondary tetitary";
global structure "population1831 density1831 economictrend1 economictrend2";
global sign_nu "county rottenindex share1826 reform_1830 economictrend2";


prob reformer31 constriots10 $reform $base_nu $demographic $structure, cluster(consid);

generate temp=constriots10;

replace constriots10=0;

predict double p_policy;

replace constriots10=temp;

prob reformer31 constriots10 $reform $base_nu $demographic $structure, cluster(consid);

predict yhat;

gen key=(p_policy<.5 & yhat>=.5);

tab key;

qqplot  yhat p_policy, xline(.5) yline(.5);

regress yhat p_policy, robust;

log c;
